'use strict';

/* App Module */
var demoApp = angular.module('demoApp', [
    'ngRoute',
    ,'ngMaterial'
    ,'ngMessages'
    //,'material.svgAssetsCache'
    ,'demoControllers'
    //'fangkeServices',
    //'fangkeDevices',
    //'fangkeUtils',
    //'fangkeDebuger'
]);

demoApp.config(['$routeProvider',
    function($routeProvider) {
        $routeProvider.
        when('/demos', {
            templateUrl: 'partials/demos.html',
            controller: 'DemosCtrl'
        }).
        when('/demo-autocomplete', {
            templateUrl: 'partials/demo-autocomplete.html',
            controller: 'DemoAutocompleteCtrl'
        }).
        when('/demo-autocomplete-custom-template', {
            templateUrl: 'partials/demo-autocomplete-custom-template.html',
            controller: 'DemoAutocompleteCustomTemplateCtrl'
        }).
        when('/demo-float-label', {
            templateUrl: 'partials/demo-float-label.html',
            controller: 'DemoFloatLabelCtrl'
        }).
        when('/demo-inside-dialog', {
            templateUrl: 'partials/demo-inside-dialog.html',
            controller: 'DemoInsideDialogCtrl'
        }).
        when('/demo-bottom-sheet', {
            templateUrl: 'partials/demo-bottom-sheet.html',
            controller: 'DemoBottomSheetCtrl'
        }).
        otherwise({
            redirectTo: '/demos'
        });
        console.log('- $routeProvider');
    }]);

demoApp.config(function($mdIconProvider) {
    $mdIconProvider
        .icon('share-arrow', 'img/icons/share-arrow.svg', 24)
        .icon('upload', 'img/icons/upload.svg', 24)
        .icon('copy', 'img/icons/copy.svg', 24)
        .icon('print', 'img/icons/print.svg', 24)
        .icon('hangout', 'img/icons/hangout.svg', 24)
        .icon('mail', 'img/icons/mail.svg', 24)
        .icon('message', 'img/icons/message.svg', 24)
        .icon('copy2', 'img/icons/copy2.svg', 24)
        .icon('facebook', 'img/icons/facebook.svg', 24)
        .icon('twitter', 'img/icons/twitter.svg', 24);
}).run(function($http, $templateCache) {
    var urls = [
        'img/icons/share-arrow.svg',
        'img/icons/upload.svg',
        'img/icons/copy.svg',
        'img/icons/print.svg',
        'img/icons/hangout.svg',
        'img/icons/mail.svg',
        'img/icons/message.svg',
        'img/icons/copy2.svg',
        'img/icons/facebook.svg',
        'img/icons/twitter.svg'
    ];
    angular.forEach(urls, function(url) {
        $http.get(url, {cache: $templateCache});
    });
});
